-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate ocrd v3 #216
base: master
Are you sure you want to change the base?
Migrate ocrd v3 #216
Conversation
- separate `setup` / `_init` from processing - inherit/override `_init` - init Tesseract API once, keep as class attribute - define `process_page_pcgts` instead of `process`: - no input file loop - no METS action - just return tuples for derived images - move shared utility functions into `common` module - generate etree mapping by exporting PAGE model
ocrd_tesserocr/binarize.py
Outdated
|
||
def process(self): | ||
def process_page_pcgts(self, pcgts, output_file_id=None, page_id=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides missing the typing, this has a different signature, pcgts is not variadic here. Python allows this and it is convenient but I am wondering whether it would be better to be consistent with the typing and signature?
def process_page_pcgts(self, pcgts, output_file_id=None, page_id=None): | |
def process_page_pcgts(self, *input_pcgts, output_file_id : Optional[str] = None, page_id : Optional[str] = None) -> OcrdPage: | |
pcgts = input_pcgts[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typing – sure, I was just to lazy again.
Variadic – I thought it would be clearer like that. So we would not have to do any arity checking in the function itself – a type checker could simply detect invalid use cases which do pass multiple pages at once. But perhaps I am wrong. (Also, we already have the arity assertion in setup
.)
Depends on OCR-D/core#1240 (i.e.
ocrd>=3.0
).